#include <stdio.h>
#include <stdlib.h>
#include<assert.h>
#include "../include/des.h"

int
main( void ) 
{
	char pass[] = "Carlos Alberto Tevez";
	char key[] = "Lalalala";
	char ivec[] = "Lelelele";
	char message[] = "iphone:)";
	char *encrypted;
	char *decrypted;
	
	if( (encrypted = des( DES_ENCRYPT, ECB, pass, NULL, NULL, message)) == NULL ){
		printf( "Couldn't encrypt\n" );
		return 1;
	}

	if( (decrypted = des( DES_DECRYPT, ECB, pass, NULL, NULL, encrypted)) == NULL ){
		printf( "Couldn't decrypt\n" );
		free( encrypted );
		return 1;
	}

    assert(strcmp( message, decrypted) == 0 );
	free( encrypted );
	free( decrypted );

	return 0;
}

